﻿<!DOCTYPE html>
<html>
<head lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8">
    <title>已征集作品列表</title>
    <meta name="keywords" content="湖南省酒业协会 酒协 湖南酒业">
    <meta name="description" content="湖南省酒业协会">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link rel="stylesheet" href="__STATIC__/home/jquery_weui/css/weui.min.css"/>
    <link rel="stylesheet" href="__STATIC__/home/jquery_weui/css/jquery-weui.min.css"/>
    {css href="__PUBLIC__static/home/css/jquery.jcrop.min.css"}
</head>
<style>
    .font-color{
        color: #000;
    }
</style>
<body>
<div class="content">
    {foreach name="list" item="vo"}
    <div class="weui-cell">
        <div class="weui-cell__bd weui_cell_primary">
            <p>{$vo.username}</p>
        </div>
        <div class="weui-cell__ft">{$vo.create_time}</div>
    </div>
    <div class="weui-cell">
        <div class="weui-label">
            <span>作品</span>
        </div>
        <div class="weui-cell__bd">
            <div class="viewImage">
                <img class="viewPhone" alt="{$vo.img}" src="{$vo.img}" style="width: auto; height: 5rem;">
            </div>
        </div>
    </div>
    {/foreach}
</div>
<span class="more" style="display: block;text-align: center;margin-top: 0.7rem;font-weight: bold;">点击加载更多</span>
<input type="hidden" class="page" value="1"/>


<script src="__STATIC__/home/jquery_weui/js/jquery-2.1.4.js"></script>
<script src="__STATIC__/home/jquery_weui/js/swiper.js"></script>
<script src="__STATIC__/home/jquery_weui/js/jquery-weui.min.js"></script>
{js href="__PUBLIC__static/home/js/exif.js" /}
</body>
<script>
    $(function () {
        // 查看大图片
        $('.viewImage').on('click','img.viewPhone',function (e) {
            e.preventDefault();
            var imgmain=[];
            var tt=$(this).parents('.viewImage').find('img.viewPhone');
            var countActive=$(this).attr('data-img');
            countActive=parseFloat(countActive);
            var count=tt.length;
            console.log(count);
            for (var i=0;i<count;i++){
                imgmain.push(tt[i].alt);
            }
            console.log(imgmain);
            var pb1 = $.photoBrowser({
                items:imgmain,
                onSlideChange: function(index) {
                    console.log(index);
                    console.log()
                },
                onOpen: function() {

                },
                onClose: function() {

                },
                initIndex:countActive
            });
            pb1.open();

        });
    })
    var pages;
    $('.more').on('click',function(){
        page = $('.page').val();
        if(page == 1){
            page = $('.page').val();
        }else{
            page == pages
        }
        $.post(
            "/index/activity/works_list",
            {page:page},
            function(msg){
                if(msg.code == 200){
                    if(msg.end > 0){
                        for(var i=0; i < msg.list.length; i++){
                            var str = "<div class='weui-cell'><div class='weui-cell__bd weui_cell_primary'><p>"+msg.list[i].username+"</p></div><div class='weui-cell__ft'>"+msg.list[i].create_time+"</div></div><div class='weui-cell'><div class='weui-label'><span>作品</span></div><div class='weui-cell__bd'><div class='viewImage'><img class='viewPhone' alt='"+msg.list[i].img+"' src='"+msg.list[i].img+"' style='width: auto; height: 5rem;'></div></div></div>";
                            $('.content').append(str);
                        }
                        $('.page').val(++page);
                        pages = ++page;
                    }else{
                        $('.more').html('到底了');
                    }
                    $('.viewImage').on('click','img.viewPhone',function (e) {
                        e.preventDefault();
                        var imgmain=[];
                        var tt=$(this).parents('.viewImage').find('img.viewPhone');
                        var countActive=$(this).attr('data-img');
                        countActive=parseFloat(countActive);
                        var count=tt.length;
                        console.log(count);
                        for (var i=0;i<count;i++){
                            imgmain.push(tt[i].alt);
                        }
                        console.log(imgmain);
                        var pb1 = $.photoBrowser({
                            items:imgmain,
                            onSlideChange: function(index) {
                                console.log(index);
                                console.log()
                            },
                            onOpen: function() {

                            },
                            onClose: function() {

                            },
                            initIndex:countActive
                        });
                        pb1.open();

                    });
                }
            },'json'
        )
    })
</script>
</html>